<!-- 03VueInstance.html -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
	<link rel="stylesheet" href="./css/common.css"/>
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
	<!-- <script src="https://cdn.bootcss.com/axios/0.19.0/axios.min.js"></script> -->
	<!-- <script src="https://cdn.bootcss.com/lodash.js/4.17.15/lodash.min.js"></script> -->
</head>
<body>
	<h2>在组件上使用 v-model</h2>
	<div id="demo">
		<custom-input v-model="searchText"></custom-input>
	</div>
    <script>
		Vue.component('custom-input', {
			props: ['value'],
			template: `
				<div>
					<input
						v-bind:value="value"
						v-on:input="$emit('input', $event.target.value)"
					>
					<p>{{value}}</p>
				</div>
			`
		})
        var demo = new Vue({
			el: '#demo',
			data: {
				searchText: ''
			}
        });
    </script>
</body>
</html>